//
//  VistaInAppPurchaseManager.h
//  MyApp
//
//  Created by woshisha on 2019/1/21.
//

#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
NS_ASSUME_NONNULL_BEGIN


@protocol VistaInAppPurchaseManagerDelegate <NSObject>

    //接收到商品信息
-(void)receiveProductInfo:(SKProduct *)product;
    //购买成功反馈
-(void)successfulPurchaseOfId:(NSString *)productID andReceipt:(NSData *)transactionReceipt;
    //购买失败反馈
-(void)failedPurchaseWithError:(NSString *)errorDescripiton;
    
@end

@interface VistaInAppPurchaseManager : NSObject
    
@property (nonatomic, weak)id delegate;

@property (assign, nonatomic) NSInteger quantity;//数量

    //单例
+(instancetype)sharedInstance;
    /*
     *  请求商品信息，productID 商品ID
     */
-(void)requestProductWithID:(NSString *)productID;
    /*
     * 购买商品
     */
-(BOOL)purchaseProudct:(SKProduct *)skProduct;
@end
NS_ASSUME_NONNULL_END
